package com.ilop.siteraudio.data.util;

import com.ilop.siteraudio.data.bean.EmailBean;
import com.ilop.siteraudio.data.manage.CommonDaoUtils;
import com.ilop.siteraudio.data.manage.DaoManager;
import com.ilop.siteraudio.greendao.EmailBeanDao;

/**
 * @author skygge
 * @date 2021/2/17.
 * GitHub：javofxu@github.com
 * email：skygge@yeah.net
 * description：
 */
public class EmailDaoUtil {

    private volatile static EmailDaoUtil instance = null;
    private final CommonDaoUtils<EmailBean> mEmailUtils;
    private final EmailBeanDao mEmailDao;

    public static EmailDaoUtil getInstance(){
        if (instance == null){
            synchronized (EmailDaoUtil.class){
                if (instance == null){
                    instance = new EmailDaoUtil();
                }
            }
        }
        return instance;
    }

    private EmailDaoUtil() {
        DaoManager mManager = DaoManager.getInstance();
        mEmailDao = mManager.getDaoSession().getEmailBeanDao();
        mEmailUtils = new CommonDaoUtils(EmailBean.class, mEmailDao);
    }

    public CommonDaoUtils<EmailBean> getEmailDao(){
        return mEmailUtils;
    }
}
